﻿using System;

namespace Sustainalytics.ESGRatings.BusinessLogic.Computing.Exceptions
{
    /// <summary>
    /// Entity with the same type and Id already exists in set.
    /// </summary>
    public class DuplicateEntityException : ComputeException
    {
        public DuplicateEntityException(Guid entityId, Type entityType, Guid? setId = null)
        {
            EntityId = entityId;
            this.EntityType = entityType;
            this.SetId = setId;
        }

        public Guid EntityId { get; set; }

        public Type EntityType { get; set; }

        public Guid? SetId { get; set; }

        public override string Message
        {
            get
            {
                return string.Format("Duplicate entity of type {0} with Id {1}", EntityType, EntityId);
            }
        }
    }
}